import request from '@/utils/request'

/**
 * 获取月卡数据
 * @param {object} params 查询参数
 * @returns
 */
export function getCarCardListAPI(params) {
  return request.get('/parking/card/list', { params })
}
// JSDoc
/**
 * 新增月卡API
 * @param {{ personName: string, phoneNumber: string }} data 月卡数据
 * @returns
 */
export function addCarCardAPI(data) {
  return request.post('/parking/card', data)
}

/**
 * 获取月卡详情
 * @param {string} id 月卡id
 * @returns
 */
export function getCarCardDetailAPI(id) {
  return request.get(`/parking/card/detail/${id}`)
}

/**
 * 更新/编辑月卡
 * @param {object} data 月卡数据
 * @returns
 */
export function updateCarCardAPI(data) {
  return request.put('/parking/card/edit', data)
}

/**
 * 批量删除月卡，支持单个删除
 * @param {Array} ids 要删除的月卡id组成的数组
 * @returns
 */
export function deleteCarCardAPI(ids = []) {
  return request.delete(`/parking/card/${ids.join(',')}`)
}
